﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Microsoft.EntityFrameworkCore;

namespace WCS.Infrastructure.EFCore;

/// <summary>
/// C端用户表
/// </summary>
[Table("Sys_UserMiniProgram")]
[Index("UnionId", Name = "Sys_UserMiniProgram_UnionId_idx")]
public partial class SysUserMiniProgram
{
    /// <summary>
    /// C端用户ID
    /// </summary>
    [Key]
    [StringLength(32)]
    public string Id { get; set; } = null!;

    /// <summary>
    /// 用户昵称
    /// </summary>
    [StringLength(32)]
    public string Name { get; set; } = null!;

    /// <summary>
    /// 平台类型（1=微信,2=支付宝）
    /// </summary>
    public int PlatformType { get; set; }

    /// <summary>
    /// 小程序ID
    /// </summary>
    [StringLength(255)]
    public string? AppId { get; set; }

    /// <summary>
    /// 用户在同一微信开放平台账号下所有应用（包括小程序、公众号等）的全局唯一标识
    /// </summary>
    [StringLength(255)]
    public string? UnionId { get; set; }

    /// <summary>
    /// 用户在当前小程序中的唯一标识
    /// </summary>
    [StringLength(255)]
    public string? OpenId { get; set; }

    /// <summary>
    /// 创建时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime CreationTime { get; set; }

    /// <summary>
    /// 是否为主小程序
    /// </summary>
    public bool IsMain { get; set; }

    /// <summary>
    /// 启用状态
    /// </summary>
    public int EnableStatus { get; set; }

    /// <summary>
    /// 手机号
    /// </summary>
    [StringLength(11)]
    public string? Phone { get; set; }

    /// <summary>
    /// 密码（加密）
    /// </summary>
    [StringLength(32)]
    public string? Password { get; set; }

    /// <summary>
    /// 邮箱
    /// </summary>
    [StringLength(255)]
    public string? Email { get; set; }

    /// <summary>
    /// 用户头像URL
    /// </summary>
    [StringLength(255)]
    public string? AvatarUrl { get; set; }

    /// <summary>
    /// 最后登录时间
    /// </summary>
    [Column(TypeName = "timestamp(6) without time zone")]
    public DateTime? LastLoginTime { get; set; }

    /// <summary>
    /// 支付宝用户唯一标识
    /// </summary>
    [StringLength(16)]
    public string? UserId { get; set; }

    /// <summary>
    /// 真实姓名
    /// </summary>
    [StringLength(64)]
    public string? RealName { get; set; }

    /// <summary>
    /// 身份证
    /// </summary>
    [StringLength(18)]
    public string? IdentityCard { get; set; }
}
